package com.aabte.permissionframeworklearn.permission.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @author Daniel
 */
public class LevelUtil {

    public static final String SEPARATOR = ".";

    public static final String ROOT = "0";

    public static String calculateLevel(String parentLevel, Long parentId) {
        if (StringUtils.isBlank(parentLevel)) {
            return ROOT;
        } else {
            // 0.1.2.3
            // 0.2
            return StringUtils.join(parentLevel, SEPARATOR, parentId);
        }
    }

}
